package com.abcdefg.rabbitmqextensionsdemo.listener;

import com.abcdefg.rabbitmqextensionsdemo.constants.Constant;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

@Component
public class RetryListener {
    @RabbitListener(queues = Constant.RETRY_QUEUE)
    public void retry(Message message) {
        long deliveryTag = message.getMessageProperties().getDeliveryTag();
        System.out.printf("接收到的消息：%s,deliveryTag：%d \n", new String(message.getBody())
                , message.getMessageProperties().getDeliveryTag());
        int sum=10/0;
        System.out.println("事务处理完毕！");
    }
}
